MATLAB implementation of the generation of basis functions based on the knot vector
Below you can find a link to the MATLAB code that calculates and draws B-spline basis functions based on a given node vector.
The code execution is also possible in the free Octave environment.
Download or see Appendix 2.
After installing Octave, open the code.
The running of the code starts with the spline () precedent which sets the example vector of knot_vector = [1,1,1,2,3,3,4,5,6,7,7,7] then calculates the number of basis functions using the compute_nr_basis_functions () procedure, and calculates the degree of basis functions (homogeneous for the whole vector of nodes) using the compute_p procedure, and the vector of x points where basis functions will be counted using the mesh () procedure.
The code generates the values of the underlying functions at these points using compute_spline () and then draws the functions using the plot command in a loop. It is possible to modify the node vector in order to generate different bases.